<template>
  <div>
    <div
      id="box"
      contentEditable
    >我是p标签的内容</div>
    <button id="saveBtn">记录光标位置</button>
    <button id="restoreBtn">恢复光标位置</button>
  </div>
</template>
<script>
	document.getElementById("saveBtn").onclick=function(){
			range = saveSelection()
		}
		document.getElementById("restoreBtn").onclick=function(){
			restoreSelection(range)
		}
export default {
  data: () => ({
    range: null
  }),
  methods:{
    saveSelection
  }
}
</script>
<style lang="scss" scoped>
</style>